import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

let app = null


const render = () => {
    app = createApp(App)

    app.use(router)
    
    app.mount('#app')
}

if (!window.__POWERED_BY_QIANKUN__) {
  render()
}

// 生命周期必须导出 Promise
export async function bootstrap () {
  console.log('[vue] vue app bootstraped')
}

export async function mount (props) {
  console.log('[vue] props from main framework', props)

  render(props)
}

export async function unmount () {
  app.$destroy()
  app.$el.innerHTML = ''
  app = null
}

